package ro.msg.quiz.view;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.WindowConstants;

//AUTHOR: Ervin

//View for adding a new quiz name
@SuppressWarnings("serial")
public class AddNewQuiz1 extends JFrame {
    private static final int frameWidth = 400;
    private static final int frameHeigt = 150;

    private JLabel title = new JLabel("Title");
    private JTextField titleField = new JTextField(12);
    private JButton cancel = new JButton("Cancel");
    private JButton next = new JButton("Next");

    private JPanel panel = new JPanel();

    public AddNewQuiz1() {
	this.setSize(new Dimension(frameWidth, frameHeigt));
	this.setTitle("Smart Questionnaire 1.0 Add new questionnaire");

	panel.setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();

	JPanel pan0 = new JPanel();
	JPanel pan1 = new JPanel();

	pan0.setLayout(new FlowLayout());
	pan0.add(title);
	pan0.add(titleField);

	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 0;
	panel.add(pan0, c);

	pan1.add(cancel);
	pan1.add(next);

	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 1;
	c.gridy = 3;
	c.anchor = GridBagConstraints.EAST;
	panel.add(pan1, c);

	this.add(panel);

	this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	this.setVisible(true);
    }

    public void closeFrame() {
	this.dispose();
    }

    public JButton getCancel() {
	return cancel;
    }

    public JButton getNext() {
	return next;
    }

    public String getQuizName() {
	return titleField.getText();
    }
}
